﻿//
// RootRpceServer/pch.h
// Header for standard system include files.
//

#pragma once

#include "targetver.h"

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
#endif

// Windows Header Files:
#include <windows.h>
#include <rpc.h>
#include <Psapi.h>
#include <sddl.h>
#include <stdio.h>
#include <share.h>
#include <errno.h>
#include <processthreadsapi.h>

#define NTSTATUS long

#ifdef CREATE_ID_CAP_ROOTRPC
#define ID_CAP_ROOTRPC L"ID_CAP_ROOTRPC"
#define ID_CAP_ROOTRPC_KEYPATH CAPABILITIES_KEYPATH L"\\" ID_CAP_ROOTRPC
#define ID_CAP_ROOTRPC_APP_STRING \
	L"S-1-15-3-1024-1-1214341995-1768843008-1313030983-1919907184-5402479-1951559779-0"
#define ID_CAP_ROOTRPC_SVC_STRING L"S-1-5-21-2702878673-795188819-444038987-1383034740"
BYTE ID_CAP_ROOTRPC_APP_SID[] = {
	1,                  // Revision 1
	0xA,                // 10 sub-authorities
	0, 0, 0, 0, 0, 0xF, // 15 (48-bit big-endian) SECURITY_APP_PACKAGE_AUTHORITY
	3, 0, 0, 0,         // 3 (32-bit LE) SECURITY_CAPABILITY_BASE_RID (1)
	0, 4, 0, 0,         // 1024 (32-bit LE) consistently-set sub-authority (2)
	0, 0, 0, 1,         // 1 (32-bit LE) - arbitrary sub-authority (3)
						// ASCII "Hacking\0" (0x4861636B 696E6700) string as sub-authorities (4, 5)
						'H', 'a', 'c', 'k', 'i', 'n', 'g', 0,
						// ASCII "NCCGroup" (0x4E434347 726F7570) string as sub-authorities (6, 7)
						'N', 'C', 'C', 'G', 'r', 'o', 'u', 'p',
						// ASCII "\0RootRpc" (0x00526F6F 74527063) string as sub-authorities (8, 9)
						0, 'R', 'o', 'o', 't', 'R', 'p', 'c',
						0, 0, 0, 0 };       // 0 (32-bit LE) - RootRpc major version as sub-authority (10)
BYTE ID_CAP_ROOTRPC_SVC_SID[] = {
	1,                      // Revision 1
	5,                      // 5 sub-authorities
	0, 0, 0, 0, 0, 5,       // 5 (48-bit big-endian) SECURITY_NT_AUTHORITY
	0x15, 0, 0, 0,          // 21 (32-bit LE) SECURITY_NT_NON_UNIQUE
	0xD1, 0xA7, 0x1A, 0xA1, // 2702878673 (32-bit LE) 
	0x53, 0x9E, 0x65, 0x2F, // 795188819 (32-bit LE)
	0x4B, 0x7F, 0x77, 0x1A, // 444038987 (32-bit LE)
	'R', 'o', 'o', 't' };	// ASCII "Root" (0x526F6F74)
#else
#define ID_CAP_ROOTRPC L"ID_CAP_COMMANDCHANNEL"
#define ID_CAP_ROOTRPC_APP_STRING \
	L"S-1-15-3-1024-3256124627-3810317426-1289640966-3240387748-3150113111-874408365-2462977246-2395127491"
#define ID_CAP_ROOTRPC_SVC_STRING L"S-1-5-21-2702878673-795188819-444038987-1251"
#endif
